///////////////////////////////////////////////////////////////////////////////
//
// lighthouse3D - 3D Software Library
//
// File: CBMPFileHandler.h
//
///////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2003-2013 Marcus Reinhardt
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
//
///////////////////////////////////////////////////////////////////////////////
//
// You can find a copy of the GNU General Public License (gpl.txt) in the
// directory of the library.
//
///////////////////////////////////////////////////////////////////////////////

#ifndef _CBMPFileHandler_H_
#define _CBMPFileHandler_H_

#include "CBasicClasses.h"

///////////////////////////////////////////////////////////////////////////////
// class CBMPFileHandler : A class to open (Windows) Bitmap files (*.bmp)
///////////////////////////////////////////////////////////////////////////////

//! BMP File Header Description
struct TBMPHeader 
{
   unsigned short int bmpType;
   unsigned int       bmpFileSize;
   unsigned short int bmpReserved1;
   unsigned short int bmpReserved2;
   unsigned int       bmpDataOffset; 
};

//! BMP File Info Header Description
struct TBMPInfoHeader 
{
   unsigned int       bmpHeaderSize;
   int                bmpWidth;
   int                bmpHeight;
   unsigned short int bmpPlanes;
   unsigned short int bmpBPP;
   unsigned int       bmpCompression;
   unsigned int       bmpImageSize;
   int                bmpXResolution;
   int                bmpYResolution;
   unsigned int       bmpNColors;
   unsigned int       bmpImportantColors;
};

//! A class to import (Windows) Bitmap files (*.BMP)

class CBMPFileHandler
{

public:

    CBMPFileHandler();
    ~CBMPFileHandler();
    
    bool loadBMPFile(const char *fname);
    bool saveBMPFile(const char *fname, TPictureData *p);
    
    TPictureData *getPicDataHandle() { return &picData; };

private:

    TPictureData picData;

};

#endif
